<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>示例6</title>
</head>
<style type="text/css">
    *{
        text-align: center;
    }
</style>
<body>
    <div id="app">
     <my-component>
         <h3>内容区域</h3>
     </my-component>
    </div>
    <template id="mycomponent">
        <div>
            <p>头部区域</p>
            <slot>如果没有分发内容，则显示默认提示</slot>
            <p>底部区域</p>
        </div>
    </template>
    <script src="https://cdn.jsdelivr.net/npm/vue"></script>
    <script type="text/javascript">
        var vm = new Vue({
            el: '#app',
            data: {

            },
        components: {
            "my-component":{
                template:"#mycomponent",
            }   
       }
  });
    </script>
</body>
</html>